<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
    <link rel="stylesheet" type="text/css" href="{{url_for('static',filename='community.css')}}">
    <link href="{{ url_for('static', filename='layui/css/layui.css') }}" rel="stylesheet">
    <link href="{{ url_for('static', filename='layui/css/layui.mobile.css') }}" rel="stylesheet">

  <title>Community</title>
</head>
<body>
<!--顶部导航栏-->
<div class="topblock">
    <a href="{{ url_for('student.index')}}">
<img class="home" src="../static/layui/images/community/home.png"></a>
<div class="search">
     <form method="GET" action="{{ url_for('community.search') }}">
    <input type="text" placeholder="搜索您感兴趣的内容" class="layui-input" name="key">
      <div class="search_btn">
        <button class="layui-btn layui-btn-primary">搜索</button>
      </div>
     </form>
</div>
<div class="tabbar">
<ul class="layui-nav layui-bg-green" lay-bar="disabled">
        <li class="layui-nav-item"><a href="{{ url_for('community.category',post_type=1) }}" style="color: black;font-size: 16px">读者社区</a></li>
        <li class="layui-nav-item"><a href="{{ url_for('community.category',post_type=2) }}" style="color: black;font-size: 16px">图书专区</a></li>
        <li class="layui-nav-item"><a href="{{ url_for('community.category',post_type=4) }}" style="color: black;font-size: 16px">打听求助</a></li>
        <li class="layui-nav-item"><a href="{{ url_for('community.category',post_type=3) }}" style="color: black;font-size: 16px">资源分享</a></li>
</ul>
</div>
    <div class="topright">
     <img class="icon" src="../static/layui/images/community/account.png">
     <img class="icon" src="../static/layui/images/community/set.png">
     <img class="icon" src="../static/layui/images/community/help.png">
     <a href="{{ url_for('community.postpost')}}">
         <button type="button" class="layui-btn layui-btn-warm layui-btn-radius" >发布
         </button>
     </a>
    </div>
</div>
<!--block1-->
<div class="block1">
    <h1>我的</h1>
    <div class="post_block">
    <ul>
{% for post in my_posts %}
    <li><a href="{{ url_for('community.post_detail',post_id=post.id) }}">
      <div class="post_small">
          <div class="post_top">
              {{post.title}}
          </div>
          <div class="post_bottom">
              <img class="post_ico" src="../static/layui/images/community/like.png"><span class="layui-badge">{{ post.likes }}</span></img>
              <img class="post_ico" src="../static/layui/images/community/comment.png"></img>
               <span class="post_author">{{ post.author_id }}</span>
               <span class="post_author">{{ post.create_time }}</span>
          </div>
      </div>
    </a>
    </li>
 {% endfor %}
    </ul>
</div>
</div>

<div class="block2">
    <h1>最新</h1>
    <div class="post_block">
        <ul>
{% for post in posts %}
    <li><a href="{{ url_for('community.post_detail',post_id=post.id) }}">
        <div class="post_small">
          <div class="post_top">
              {{post.title}}
          </div>
          <div class="post_bottom">
              <img class="post_ico" src="../static/layui/images/community/like.png"><span class="layui-badge">{{ post.likes }}</span></img>
              <img class="post_ico" src="../static/layui/images/community/comment.png"></img>
              <span class="post_author">由{{ post.author_id }}</span>
              <span class="post_author">于{{ post.create_time }}发布</span>
          </div>
        </div>
    </a></li>
            {% endfor %}
        </ul>
  </div>
</div>

<div class="side_block">
    <h1>公告</h1>
    <ul >
{% for announce in announces %}
    <li class="announce"><a href="{{ url_for('community.announce_detail',announce_id=announce.id) }}">
     <div class="announce_inner">
         <div class="announce_title">{{announce.title}}</div>
         <span class="announce_time">{{ announce.create_time }}</span>
     </div>
    </a></li>
{% endfor %}
    </ul>
</div>



<div class="banner">
<div class="layui-carousel" id="ID-carousel-demo-image">
  <div carousel-item>
    <div><img src="../static/layui/images/community/banner1.png"></div>
    <div><img src="../static/layui/images/community/banner2.png"></div>
    <div><img src="../static/layui/images/community/banner3.png"></div>
  </div>
</div>
</div>

<script src="//cdn.staticfile.org/layui/2.9.9/layui.js"></script>
  <script>
  //右侧固定边栏


  //banner
  layui.use(function(){
  var carousel = layui.carousel;
  // 渲染 - 图片轮播
  carousel.render({
    elem: '#ID-carousel-demo-image',
    width: '100%',
    height: '100%',
    interval: 3000
  });
});

  </script>
</body>
</html>